{% extends 'base.html' %}

{% load i18n %}
{% load custom_formatting %}
{% load custom_url_tags %}
{% load custom_translation %}

{% block extra_html_head_stuff %}
<link type="text/css" href="/static/css/tooltips.css" rel="stylesheet" />
{% endblock extra_html_head_stuff %}


{% block title %}
{% if not run %}
{% trans "KataGo - Networks" %}
{% else %}
{% blocktrans with run_name=run.name %} KataGo - Networks for {{run_name}} {% endblocktrans %}
{% endif %}
{% endblock %}

{% block content %}
{% if run %}

<h1 class="title">{% blocktrans with run_name=run.name %}Networks for {{run_name}}{% endblocktrans %}</h1>

{% url 'networks' current_run.name as current_url %}
{% url 'runs' as older_url %}
{% include 'handle_multiple_runs.html' %}

{% blocktrans with katago_releases_url="https://github.com/lightvector/KataGo/releases" %}
<p>
Here are stats and download links for all the neural networks from this run.
<p>
If you are a casual user, you want "Network File" - you can directly use this .bin.gz file with <a href="{{katago_releases_url}}">KataGo</a>.
<p>
Elo ratings are approximate and are *not* necessarily comparable to the Elos from any other bot or run. Uncertainty radius displayed is approximately two sigmas.
{% endblocktrans %}

<p>
{% if latest_network and latest_network.model_file %}
<span class="has-text-weight-medium">{% trans "Latest network" %}:</span> <a href="{{ latest_network.model_download_url }}">{{ latest_network.name }}</a>
{% endif %}
<p>
{% if strongest_confident_network and strongest_confident_network.model_file %}
<span class="strongestNetworkStyle"><span class="has-text-weight-medium">{% trans "Strongest confidently-rated network" %}:</span> <a href="{{ strongest_confident_network.model_download_url }}">{{ strongest_confident_network.name }}</a></span>
{% endif %}

<table class="table mt-3">
  <tr>
    <th> {% trans "Name" %} <i class="fas fa-info-circle" tabindex="-1" title="{% trans "b = number of blocks, c = number of channels, s = number of training sample steps, d = latest data rows in the run this net trained on" %}"></i>
</th>
    <th> {% trans "Uploaded At" %} </th>
    <th> {% trans "Elo Rating" %} </th>
    <th> {% trans "Network File" %} </th>
    <th> {% trans "Raw TF Weights" %} </th>
  </tr>
  {% for network in network_list %}
  <tr class="{{ network|network_row_style:strongest_confident_network }}">
    <td>
      {{ network.name }}
      {% if network.notes %}
      <i class="fas fa-info-circle" tabindex="-1" title="{{network.notes}}"></i>
      {% endif %}
    </td>
    <td> {{ network.created_at|isotimestr }} </td>
    <td> {{ network.rating }} - ({{ network.log_gamma_game_count|as_n_games_str }}) </td>
    <td> {{ network.model_download_url|download_link_html|safe }} </td>
    <td> {{ network.model_zip_download_url|download_link_html|safe }} </td>
  </tr>
  {% endfor %}
</table>

{% endif %}
{% endblock content %}
